/*
    This file is part of Epoch <http://code.google.com/p/epoch/>.

    Copyright (C) 2011 Adam Meily <meily.adam@gmail.com>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/


#include "Backup.h"
// done

Backup::Backup() : Model()
{
}

Backup::Backup(const Backup& other)
        : m_startTime(other.m_startTime), m_endTime(other.m_endTime),
          m_device(other.m_device), Model(other) // m_lastPath(other.m_lastPath),
          //m_state(other.m_state), m_revision(other.m_revision)
{
}

Backup::Backup(const Device& device) : Model(), m_device(device)
{
}

Backup::Backup(int id, const Device& device, const QDateTime& start,
               const QDateTime& end)
        : Model(id), m_device(device), m_startTime(start), m_endTime(end)
{
}


Backup::~Backup()
{

}

Backup& Backup::operator=(const Backup& other)
{
    m_device = other.m_device;
    m_endTime = other.m_endTime;
    //m_lastPath = other.m_lastPath;
    //m_revision = other.m_revision;
    m_startTime = other.m_startTime;
    //m_state = other.m_state;
    Model::operator=(other);
    
    return *this;
}

const QDateTime& Backup::endTime() const
{
    return m_endTime;
}

const QDateTime& Backup::startTime() const
{
    return m_startTime;
}

bool Backup::isNull() const
{
    return m_device.isNull() && m_endTime.isNull() && m_startTime.isNull();
}
/*
const QString& Backup::lastPath() const
{
    return m_lastPath;
}
*/
const Device& Backup::device() const
{
    return m_device;
}
/*
int Backup::revision() const
{
    return m_revision;
}

Backup::BackupState Backup::state() const
{
    return m_state;
}

void Backup::state(Backup::BackupState state)
{
    m_state = state;
}
*/

void Backup::begin()
{
    m_startTime = QDateTime::currentDateTime();
    dirty();
}

void Backup::end()
{
    m_endTime = QDateTime::currentDateTime();
    dirty();
}
